package com.linghang.association.controller;
import com.linghang.association.resp.CommonResp;
import com.linghang.association.service.AuthorityService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
 * @author LinyaT052
 * @date 2022年07月24日 11:35
 * 权限与授权相关控制层
 */
@Service
@RestController
public class AuthorityController {
        @Resource
        private  AuthorityService authorityService;
    /**
     * 根据用户登录的用户名查找用户相关权限
     * @param username
     * @return
     */
    @RequestMapping("/login/find-authority")
        public CommonResp test(String username){
                CommonResp resp = new CommonResp();
               LinkedHashMap<String,Object> map = new LinkedHashMap<>();
                map.put("Identify",authorityService.getRole(username));
                map.put("Authority",authorityService.getResource(username));
                resp.setContent(map);
                return resp;
        }
}
